package org.gas.barapraja.admin.db.dao.impl;

import javax.persistence.Query;

import org.gas.barapraja.admin.db.dao.GasEntityDao;
import org.gas.barapraja.admin.db.dao.MessageDao;
import org.gas.barapraja.admin.db.entity.Message;
import org.gas.barapraja.admin.util.AppContext;
import org.springframework.stereotype.Repository;

@Repository(AppContext.MESSAGE_DAO)
public class MessageDaoImpl extends GasEntityDao<Message, Long> implements MessageDao {

	public MessageDaoImpl(){
		super();
	}

	public Message findByMessageId(String MessageId) {
		Query query=entityManager.createQuery("select a from Message a where a.MessageId=?1");
		query.setParameter(1, MessageId);
		return (Message)query.getSingleResult();
	}

}
